package logic

import (
	"context"
	"go.uber.org/zap"
	"smart-health-platforms/pkg"
	"user_srv/internal/svc"
	"user_srv/model"

	"user_srv/user"

	"github.com/zeromicro/go-zero/core/logx"
)

type CollectDelLogic struct {
	ctx    context.Context
	svcCtx *svc.ServiceContext
	logx.Logger
}

func NewCollectDelLogic(ctx context.Context, svcCtx *svc.ServiceContext) *CollectDelLogic {
	return &CollectDelLogic{
		ctx:    ctx,
		svcCtx: svcCtx,
		Logger: logx.WithContext(ctx),
	}
}

// 删除指定商品
func (l *CollectDelLogic) CollectDel(in *user.CollectDelRequest) (*user.CollectDelResponse, error) {
	var coll model.Collection
	coll.Id = uint32(in.CollectionId)
	err := coll.DeletedCollection()
	if err != nil {
		pkg.Error("失败", zap.Error(err))
		return nil, err
	}
	return &user.CollectDelResponse{
		Msg: "成功",
	}, nil
}
